import { RouteInterface } from "./routeInterface";
import { RouteUniImpl,uniRouteMixin } from './RouteUniImpl'


export class DefaultFactory{
	
	private static route;
	private static mixin;
	
	static getInstance():RouteInterface{
		if(DefaultFactory.route){
			return DefaultFactory.route
		}
		const MODEL_UNI='UNI'
		const models=[MODEL_UNI]
		let model:string = process.env.VUE_APP_TICK_ROUTE__MODEL
		model = model || MODEL_UNI
		if(models.indexOf(model) < 0){
			throw "VUE_APP_TICK_ROUTE__MODEL 配置错误"
		}
		model = model.toUpperCase()
		switch(model){
			case MODEL_UNI:
				DefaultFactory.route = new RouteUniImpl();
				DefaultFactory.mixin = uniRouteMixin;
				break;
				
			default:
		}
		return DefaultFactory.route
	}
	static getMixin():any{
		DefaultFactory.getInstance()
		return DefaultFactory.mixin
	}
}